package com.cxhc.system.service.app.impl;

import java.util.List;

import com.cxhc.system.domain.app.ApprovalFlow;
import com.cxhc.system.mapper.app.ApprovalFlowMapper;
import com.cxhc.system.service.app.IApprovalFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 事项审批流程Service业务层处理
 * 
 * @author Dhq
 * @date 2024-08-06
 */
@Service
public class ApprovalFlowServiceImpl implements IApprovalFlowService
{
    @Autowired
    private ApprovalFlowMapper approvalFlowMapper;

    /**
     * 查询事项审批流程
     * 
     * @param id 事项审批流程主键
     * @return 事项审批流程
     */
    @Override
    public ApprovalFlow selectApprovalFlowById(Long id)
    {
        return approvalFlowMapper.selectApprovalFlowById(id);
    }

    /**
     * 查询事项审批流程列表
     * 
     * @param approvalFlow 事项审批流程
     * @return 事项审批流程
     */
    @Override
    public List<ApprovalFlow> selectApprovalFlowList(ApprovalFlow approvalFlow)
    {
        return approvalFlowMapper.selectApprovalFlowList(approvalFlow);
    }

    @Override
    public List<ApprovalFlow> selectApprovalFlowListByEventApprovalId(Long eventApprovalId){
        return approvalFlowMapper.selectApprovalFlowList(new ApprovalFlow().setEventId(eventApprovalId));
    }

    @Override
    public List<ApprovalFlow> selectApprovalFlowOldListByEventApprovalId(Long eventApprovalId){
        return approvalFlowMapper.selectApprovalFlowOldList(new ApprovalFlow().setEventId(eventApprovalId));
    }

    @Override
    public ApprovalFlow selectNextApprovalByEventApprovalId(Long eventApprovalId) {
        return approvalFlowMapper.selectNextApprovalByEventApprovalId(eventApprovalId);
    }

    /**
     * 新增事项审批流程
     * 
     * @param approvalFlow 事项审批流程
     * @return 结果
     */
    @Override
    public int insertApprovalFlow(ApprovalFlow approvalFlow)
    {
        return approvalFlowMapper.insertApprovalFlow(approvalFlow);
    }

    /**
     * 修改事项审批流程
     * 
     * @param approvalFlow 事项审批流程
     * @return 结果
     */
    @Override
    public int updateApprovalFlow(ApprovalFlow approvalFlow)
    {
        return approvalFlowMapper.updateApprovalFlow(approvalFlow);
    }

    /**
     * 批量删除事项审批流程
     * 
     * @param ids 需要删除的事项审批流程主键
     * @return 结果
     */
    @Override
    public int deleteApprovalFlowByIds(Long[] ids)
    {
        return approvalFlowMapper.deleteApprovalFlowByIds(ids);
    }

    /**
     * 删除事项审批流程信息
     * 
     * @param id 事项审批流程主键
     * @return 结果
     */
    @Override
    public int deleteApprovalFlowById(Long id)
    {
        return approvalFlowMapper.deleteApprovalFlowById(id);
    }
}
